<template>
    <div>
        <h1>父组件</h1>
        <button @click="handlerGetSon">获取子组件内容</button>
        <Child></Child>
     
    </div>
</template>

<script>
import Child from './Child.vue';
export default {
    components:{
        Child
    },
    data() {
         return {
            msg:"parent"
         }
    },
    methods:{
        handlerGetSon() {

            // console.log(this);
            // 父组件获取子组件的内容
            console.log( this.$children[0].msg);
           

        }
    }
};
</script>

<style>

</style>
